package cn.jsc.feign.client;

import cn.jsc.doc.CourseDoc;
import cn.jsc.feign.fallback.EsFeignClientFallback;
import cn.jsc.result.JSONResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient(value = "service-es",fallbackFactory = EsFeignClientFallback.class )
public interface EsFeignClient {

    /**
     * 往ES中存数据
     */
    @PostMapping("/es/saveCourse")
    JSONResult insert(@RequestBody CourseDoc doc);

    /**
     * 往ES中批量存数据
     */
    @PostMapping("/es/saveBatchCourse")
    JSONResult insertBatch(@RequestBody List<CourseDoc> list);

    /**
     * 对ES中批量删除数据
     */
    @PostMapping("/es/deleteBatchCourse")
    JSONResult deleteBatch(@RequestBody List<CourseDoc> list);
}
